package day3.HomeWork;

public class Test3 {
    public static void main(String[] args) {
        Action action1 = new Action() {
            @Override
            public String[] test(String str) {
               // String[] result = str.split("\\|");
                String[] result = str.split("[|]");

                return result;
            }
        };
        Action action2 = new Action() {
            @Override
            public String[] test(String str) {
                String[] result = str.split("-");
                return result;
            }
        };

        String[] result = action1.test("a|b|c");
        printResult(result);

        String[] result2 = action2.test("a-b-c");
        printResult(result2);

    }
    public static void printResult(String[] result) {
        System.out.print("[");
        for (int i = 0; i < result.length ; i++) {
            System.out.print("\""+result[i]+"\"");
            if(i< result.length-1){
                System.out.print(",");
            }
        }
        System.out.println("]");
    }
}
